<template>
  <el-dialog
    title="详情"
    :close-on-click-modal="false"
    append-to-body
    :visible.sync="visible"
    class="jsbos-dialog jsbos-dialog_center"
    lock-scroll
    width="600px"
  >
    <el-row :gutter="15" class="">
      <el-form
        v-loading="loading"
        ref="elForm"
        :model="dataForm"
        size="small"
        label-width="100px"
        label-position="right"
      >
        <template v-if="!loading">
          <el-col :span="24">
            <el-form-item label="封面" prop="cover">
              <p>{{ dataForm.cover }}</p>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="目录" prop="catalogId">
              <p>{{ dataForm.catalogId }}</p>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="名称" prop="name">
              <p>{{ dataForm.name }}</p>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="标签" prop="label">
              <p>{{ dataForm.label }}</p>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="有效标志" prop="enabledMark">
              <p>{{ dataForm.enabledMark }}</p>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="类型" prop="type">
              <p>{{ dataForm.type }}</p>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="大小" prop="fileSize">
              <p>{{ dataForm.fileSize }}</p>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="文件路径" prop="url">
              <p>{{ dataForm.url }}</p>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="路径" prop="fileJson">
              <p>{{ dataForm.fileJson }}</p>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="可见类型" prop="scopeType">
              <p>{{ dataForm.scopeType | dynamicText(scopeTypeOptions) }}</p>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="可见范围" prop="scope">
              <p>{{ dataForm.scope }}</p>
            </el-form-item>
          </el-col>
        </template>
      </el-form>
    </el-row>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false"> 取 消</el-button>
    </span>
  </el-dialog>
</template>
<script>
import request from "@/utils/request";
import PrintBrowse from "@/components/print-browse/index.vue";
import jsbos from "@/utils/jsbos";

export default {
  components: { PrintBrowse },
  props: [],
  data() {
    return {
      visible: false,
      loading: false,
      printBrowseVisible: false,
      printId: "",
      dataForm: {
        id: "",
        cover: [],
        catalogId: "",
        name: "",
        label: [],
        enabledMark: 0,
        type: "",
        fileSize: "",
        url: "",
        fileJson: "",
        scopeType: "",
        scope: "",
        creatorUserId: "",
        creatorTime: "",
        lastModifyUserId: "",
        lastModifyTime: "",
      },
      catalogIdProps: {
        children: "children",
        label: "fullName",
        value: "enCode",
      },
      scopeTypeOptions: [
        { fullName: "选项一", id: "1" },
        { fullName: "选项二", id: "2" },
      ],
    };
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {},
  methods: {
    dataInfo(dataAll) {
      let _dataAll = dataAll;
      this.dataForm = _dataAll;
    },

    init(id) {
      this.dataForm.id = id || 0;
      this.visible = true;
      this.$nextTick(() => {
        if (this.dataForm.id) {
          this.loading = true;
          request({
            url: "/api/course/TemsKnowledge/detail/" + this.dataForm.id,
            method: "get",
          }).then((res) => {
            this.dataInfo(res.data);
            this.loading = false;
          });
        }
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.jsbos-row-style {
  padding: 10px 10px 10px 0;

  > .el-row {
    margin: 0 !important;
    padding: 0 16px;
  }

  .el-row:nth-child(0) {
    padding: 0px !important;
  }

  > .el-col {
    padding: 0px !important;

    .el-form-item {
      margin-bottom: -1px !important;
      margin-right: -1px;
      border: 1px solid var(--border-4) !important;
      background-color: var(--light-blue) !important;
    }

    .el-form-item__label {
      line-height: 38px;
      height: 100%;
    }

    .el-form-item__content {
      line-height: 38px;
      padding-left: 20px;
      background-color: var(--white) !important;
      border-left: 1px solid var(--border-4) !important;
    }
  }
}
</style>
